package com.lz.constant;


public class RWLocK {
   static int c;
    static final int SHARED_SHIFT = 16;     //1 0000 0000 0000 0000
    static final int SHARED_UNIT = (1 << SHARED_SHIFT);
    static final int MAX_COUNT = (1 << SHARED_SHIFT) - 1; //1111 1111 1111 1111
    static final int EXCLUSIVE_MASK = (1 << SHARED_SHIFT) - 1; //

    public static void main(String[] args) {
        System.out.println(SHARED_UNIT);
        System.out.println(MAX_COUNT);
        System.out.println(EXCLUSIVE_MASK);
        c=131072;
        int i = sharedCount(c);
        System.out.println(i);
        int i1 = exclusiveCount(c);
        System.out.println(i1);
    }

    static int sharedCount(int c) {
        return c >>> SHARED_SHIFT;
    }

    /** Returns the number of exclusive holds represented in count. */
    static int exclusiveCount(int c) {
        return c & EXCLUSIVE_MASK;
    }
}
